<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="box"></div>
    <script>
        let oBox = document.getElementById('box');
        setInterval(function(){
            let myTime = new Date();
            let year = myTime.getFullYear();
            let month = (myTime.getMonth() + 1 +'').padStart(2,"0");
            let date = (myTime.getDate()+'').padStart(2,"0");
            let hours = (myTime.getHours()+'').padStart(2,"0");
            let min = (myTime.getMinutes()+'').padStart(2,"0");
            let sec = (myTime.getSeconds()+'').padStart(2,"0");
            let str = `${year}-${month}-${date} ${hours}:${min}:${sec}`;
            oBox.innerHTML = str;
        },1000)
        
    </script>
</body>
</html>